package org.exteen.tag.core;

import org.exteen.ExteenException;
import org.exteen.exec.ExteenContext;
import org.exteen.exec.ExteenPathChangeException;
import org.exteen.exec.Tag;
import org.exteen.output.ExteenStream;

public class OtherwiseTag extends Tag {

    public void doTag(ExteenContext ctx, ExteenStream stream) {
        if (!(ctx.getParent().getTagMark() instanceof ChooseTag)) {
            throw new ExteenException("Tag otherwise must be placed inside choose tag");
        }
        super.doTag(ctx, stream);
        throw new ExteenPathChangeException(ExteenPathChangeException.Type.BREAK);
    }
}